#include "../src/MultiLineChart.hpp"
#include "../src/BarChart.hpp"
#include <gtkmm.h>
#include <memory>
#include <random>

class testWindow : public Gtk::Window
{
public:
  testWindow()
    : chart(10,0,10)
  {
    set_title("test");
    set_default_size(300, 300);
    set_child(draw);
    draw.set_expand();
    draw.set_draw_func(sigc::mem_fun(*this,&testWindow::Draw));
    std::random_device rad;
    std::mt19937 rd(rad());
    std::uniform_int_distribution<> uni(0,10);
    for(int i=0;i<10;i++)
      chart.InputData(uni(rd));
  }
private:
  Gtk::DrawingArea draw;
  BarChart chart;
  void Draw(const Cairo::RefPtr<Cairo::Context>& c, int x,int y)
  {
      chart.DrawCall(c,x,y,dynamic_cast<Gtk::Widget*>(&draw));
  }
};

int main(int argc, char* argv[])
{
  auto app = Gtk::Application::create("org.gtkmm.examples.base");
  return app->make_window_and_run<testWindow>(argc, argv);
}

